public class XMLParser {
/*
import java.io.*;import javax.microedition.io.*;import org.kxml.*;import org.kxml.parser.*;public class RSSParser {
  protected RSSListener mRSSListener;    public void setRSSListener(RSSListener listener) {
    mRSSListener = listener;  }
  
  // Non-blocking.
  public void parse(final String url) {
    Thread t = new Thread() {
      public void run() {
        // set up the network connection
        HttpConnection hc = null;                try {
          hc = (HttpConnection)Connector.open(url);          parse(hc.openInputStream());        }
        catch (IOException ioe) {
          mRSSListener.exception(ioe);        }
        finally {
          try { if (hc != null) hc.close(); }
          catch (IOException ignored) {}
        }
      }
    };    t.start();  }
  
  // Blocking.
  public void parse(InputStream in) throws IOException {
    Reader reader = new InputStreamReader(in);    XmlParser parser = new XmlParser(reader);    ParseEvent pe = null;    parser.skip();    parser.read(Xml.START_TAG, null, "rss");    parser.skip();    parser.read(Xml.START_TAG, null, "channel");        boolean trucking = true;    boolean first = true;    while (trucking) {
      pe = parser.read();      if (pe.getType() == Xml.START_TAG) {
        String name = pe.getName();        if (name.equals("item")) {
          String title, link, description;
          title = link = description = null;          while ((pe.getType() != Xml.END_TAG) ||
              (pe.getName().equals(name) == false)) {
            pe = parser.read();            if (pe.getType() == Xml.START_TAG &&
                pe.getName().equals("title")) {
              pe = parser.read();              title = pe.getText();            }
            else if (pe.getType() == Xml.START_TAG &&
                pe.getName().equals("link")) {
              pe = parser.read();              link = pe.getText();            }
            else if (pe.getType() == Xml.START_TAG &&
                pe.getName().equals("description")) {
              pe = parser.read();              description = pe.getText();            }
          }
          mRSSListener.itemParsed(title, link, description);        }
        else {
          while ((pe.getType() != Xml.END_TAG) ||
              (pe.getName().equals(name) == false))            pe = parser.read();        }
      }
      if (pe.getType() == Xml.END_TAG &&
            pe.getName().equals("rss"))        trucking = false;    }
  }
*/
}
        
